# frozen_string_literal: true

class CreateRules < ActiveRecord::Migration[6.0]
  def change
    create_table :rules do |t|
      t.string  :uuid,            null: false,  limit: 64
      t.string  :name,            null: false,  limit: 255
      t.integer :current_version, null: true,   limit: 4
      t.string  :type,            null: false,  limit: 64
      t.string  :status,          null: false,  limit: 32, default: 'created'
      t.string  :description,     null: true,   limit: 255
      t.timestamps                null: false
    end

    add_index :rules, :uuid, unique: true
    add_index :rules, :current_version
  end
end
